<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title>Пациент</title>
        <link type="text/css" rel="stylesheet" href="resources/css/default.css" />   
    </h:head>
    <h:body id="body">
        <table width="100%" border="1">
            <tr>
                <td width="100%">
                    <table width="100%" border="1" align="center">
                        <td align="center">
                            <ui:include src="fortop.xhtml"/>
                        </td>
                    </table>
                </td>
            </tr>
            <tr>
                <table width="100%" border="1" align="top" height="600px" >
                    <td width="15%" valign="top">
                        <ui:include src="left.xhtml"/>
                    </td>
                    <td width="75%" align="left" valign="top">
                        <table border="1" width="100%">
                            <td width="33%" valign="top">
                                <h:form id="pacient">
                                    <p:dataGrid id="ggg" var="pac" value="#{pacient.getPacientsWithbyStatus('4')}" columns="1" paginator="true"  emptyMessage="Неразпределенных пациентов нет"
                                                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                                paginatorPosition="bottom" style="border-radius: 10px;"  rows="10">
                                        <p:column>
                                            <p:commandButton style="width: 100%; text-align: left"  value="#{pac.lastName}  #{pac.name} #{pac.midName}" actionListener="#{pacient.pacientName(pac.name,pac.patientId)}" ajax="true" update=":text,:chamber" id="get"/>
                                            <p:blockUI block=":pacient" trigger="get" />
                                        </p:column>
                                    </p:dataGrid>                                    
                                </h:form>
                            </td>
                            <td width="33%" valign="top">
                                <h:form id="chamber">
                                    <p:dataGrid id="ggg" var="cham" value="#{chambers.getChambersList()}" columns="1" paginator="false"  emptyMessage="Зарегистрируйте плалты"
                                                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                                paginatorPosition="bottom" style="border-radius: 10px;" rendered="#{pacient.fl == 1}">
                                        <p:commandButton style="width: 100px; text-align: left"  value="#{cham.name}  (#{chambers.getBuzyBeds(cham.chamberId)}/#{cham.bedsesByChamberId.size()})" actionListener="#{chambers.freeBeds(cham.chamberId,cham.name)}" ajax="true" update=":beds"/>
                                    </p:dataGrid>                                    
                                </h:form>
                            </td>
                            <td width="33%" valign="top">
                                <h:outputText id="text" value="#{pacient.name}"/>
                                <h:form id="beds">
                                     
                                    <p:dataGrid id="hhh" var="beds" value="#{chambers.getFreeBedsList()}" columns="1" paginator="false" emptyMessage="Нет свободных коек"  
                                                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rows="5" 
                                                paginatorPosition="bottom"  >
                                        <p:column>
                                            <p:commandButton style="width: 100%;text-align: left" value="№#{beds.bedId}   #{beds.patientesByPatientId.name}" actionListener="#{pacient.changePacientStatus(beds.bedId)}" id="regbed" action="new_pacient.xhtml" ajax="false"/>
                                        </p:column>
                                     <p:blockUI block=":beds" trigger="regbed" />
                                    </p:dataGrid>   
                                </h:form>
                            </td>
                        </table>
                    </td>
                </table>
            </tr>
        </table> 
    </h:body>
</html>

